package com.woniuxy.consumerfeign.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.woniuxy.commons.entity.Goods;
import com.woniuxy.commons.service.ProviderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/feign")
public class FeignController {
    @Resource
    private ProviderService providerService;

    @HystrixCommand(fallbackMethod = "aaa")
    @GetMapping("/all")
    public List<Goods> all(){
        return providerService.all();
    }
    public List<Goods> aaa(){
        return providerService.all();
    }
    @GetMapping("/find")
    public Goods find(){
        return providerService.find(1001);
    }
}
